﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DTO;
using DAO;

namespace BUS
{
    public class NhaXuatBanServices
    {
        public static List<NhaXuatBanDTO> LayDanhSachNXB()
        {
            List<NhaXuatBanDTO> list = new List<NhaXuatBanDTO>();
            try
            {
                NhaXuatBanRepository nxbDAO = new NhaXuatBanRepository();
                list = nxbDAO.LayDanhSachNXB();
            }
            catch (System.Exception )
            {
            }
            return list;
        }

        public static void ThemNhaXuatBan(NhaXuatBanDTO nxbDTO)
        {
            try
            {
                NhaXuatBanRepository nxbDAO = new NhaXuatBanRepository();
                nxbDAO.ThemNhaXuatBan(nxbDTO);
            }
            catch (System.Exception)
            {
            }
        }

        public static void CapNhatNhaXuatBan(NhaXuatBanDTO nxbDTO)
        {
            try
            {
                NhaXuatBanRepository nxbDAO = new NhaXuatBanRepository();
                nxbDAO.CapNhatNXB(nxbDTO);
            }
            catch (System.Exception)
            {
            }
        }

        public static int LayMaNXBMax()
        {
            int maNXB = 0;
            try
            {
                NhaXuatBanRepository nxbDAO = new NhaXuatBanRepository();
                maNXB = nxbDAO.LayMaNXBMax();
            }
            catch (System.Exception)
            {
            }
            return maNXB;
        }

        public static NhaXuatBanDTO LayThongTinNXB(int maNXB)
        {
            NhaXuatBanDTO nxbDTO = new NhaXuatBanDTO();
            try
            {
                NhaXuatBanRepository nxbDAO = new NhaXuatBanRepository();
                nxbDTO = nxbDAO.LayThongTinNXB(maNXB);
            }
            catch (System.Exception)
            {
            }
            return nxbDTO;
        }
    }
}
